home *** CD-ROM | disk | FTP | other *** search
- onClipEvent(enterFrame){
- function wallizq()
- {
- return dx < 0 && mapa.hitTest(_X - 20,_Y - 5,true);
- }
- function wallder()
- {
- return dx > 0 && mapa.hitTest(_X + 20,_Y - 5,true);
- }
- function setdx()
- {
- if(hitable)
- {
- if(!u)
- {
- dx = SPEED;
- u = true;
- }
- if(wallder())
- {
- dx = -1 * SPEED;
- }
- if(wallizq())
- {
- dx = SPEED;
- }
- }
- }
- function setdy()
- {
- dy = 3;
- if(this.hitTest(mapa))
- {
- dy = 16;
- }
- if(mapa.hitTest(_X,_Y,true))
- {
- dy = 0;
- }
- }
- function doexplode()
- {
- myColor.setTransform(myColorNormal);
- this.gotoAndStop("death");
- }
- function dorespawn()
- {
- currentdamage = 0;
- hitted = false;
- flashing = false;
- timerdamage = 0;
- death = false;
- dx = SPEED;
- this.gotoAndStop("standing");
- }
- function drawframe()
- {
- dx <= 0 ? (_xscale = Math.abs(_xscale)) : (_xscale = Math.abs(_xscale) * -1);
- }
- _X = _X - heroe.scrollspeed;
- _Y = _Y - heroe.vscrollspeed;
- _visible = false;
- hitable = this.hitTest(_root.mascara);
- if(hitable)
- {
- _visible = true;
- if(this.sprite.hotzone.hitTest(heroe.sprite.hotzone))
- {
- heroe.damage = 2;
- heroe.hitted = true;
- }
- if(this.sprite.hotzone.hitTest(_parent.shoot1) && hitable)
- {
- hitted = true;
- _root.shoot1.impact = true;
- _root.hitted.start();
- }
- if(timerdamage == 0 && hitted)
- {
- timerdamage = FLASHTIME;
- currentdamage += DAMAGE;
- }
- if(timerdamage > 0)
- {
- flashing = true;
- timerdamage % 3 != 0 ? myColor.setTransform(myColorNormal) : myColor.setTransform(myColorTransform);
- timerdamage--;
- }
- if(flashing && timerdamage == 0)
- {
- flashing = false;
- myColor.setTransform(myColorNormal);
- hitted = false;
- }
- if(currentdamage >= MAXDAMAGE)
- {
- myColor.setTransform(myColorTransform);
- death = true;
- }
- if(death && !du)
- {
- _root.shoot1.impact = false;
- du = true;
- dx = 0;
- }
- }
- if(!death)
- {
- setdx();
- setdy();
- _X = _X + dx;
- _Y = _Y + dy;
- drawframe();
- }
- else
- {
- doexplode();
- }
- }
-